<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>取消订单</title>
    <link rel="stylesheet" type="text/css" href="../../../css/aui/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../../css/html/issued/post_your_want_frm.css" />
    <style>
        .aui-list .textarea {
            border: 1px solid #ddd;
            height: 5rem;
        }

        .btn {
            background: #0689FB;
            color: #fff;
            text-align: center;
            padding: 0 0.5rem;
            border-radius: 0.1rem;
        }
    </style>
</head>

<body>
    <div id="app" v-clock>
        <div class="aui-list">
            <div style="padding:1rem 0.75rem;">
                <div>取消说明</div>
                <div><textarea class="textarea" v-model="info.uncomment" placeholder="可输入取消说明"></textarea></div>
            </div>
            <div class="btn" @click="submit()">提交</div>
        </div>
    </div>
</body>
<script src="../../../script/api.js" charset="utf-8"></script>
<script src="../../../script/aui/aui-tab.js" charset="utf-8"></script>
<script src="../../../script/common/jquery-3.3.1.min.js" charset="utf-8"></script>
<script src="../../../script/common/check.js" charset="utf-8"></script>
<script src="../../../script/common/common.js" charset="utf-8"></script>
<script src="../../../script/common/config.js" charset="utf-8"></script>
<script src="../../../script/common/vue.min.js" charset="utf-8"></script>
<script>
    apiready = function() {
        api.parseTapmode();
        vm.init();
    }

    var vm = new Vue({
        el: "#app",
        data: {
            userInfo: {},
            info: {
                order_id: '',
                drawee_user_id: '',
                uncomment: '',
            }
        },
        methods: {
            init() {
                this.userInfo = get_local('userInfo');
                this.info.drawee_user_id = this.userInfo.user_id;
                this.info.order_id = api.pageParam.order_id;

                console.log(JSON.stringify(this.info));
            },
            submit() {
                if (!is_define(this.info.uncomment)) {
                    $toast("请输入取消说明");
                    return;
                }
                _ajax(Config.api.TransferCannelOrder, this.info, function(ret) {
                    console.log(JSON.stringify(ret));
                    if (ret.code === 200) {
                        $toast("提交成功");
                        api.sendEvent({
                            name: 'add_offlineOrders',
                        });

                        setTimeout(function() {
                            close_w();
                        }, 1000);
                    } else {
                        $toast(ret.msgs);
                    }
                });
            }
        }
    });
</script>

</html>
